

package examples.radio;

import commandz.cli.*;
import java.util.Collection;


/**
 *  Command for retrieving the status of the radio.
 */
public final class StatusCommand implements Command
{
    private Radio radio;


    public StatusCommand(Radio radio)
    {
        this.radio = radio;
    }


    public String getName()
    {
        return "stat";
    }


    public String getDescription()
    {
        return "Shows the current reception status.";
    }


    public void publishParameters(Collection<Parameter> params)
    {
        // No parameters required.
    }


    public void execute()
    {
        System.out.printf("Receiving %.2f %s, volume %d.\n",
            this.radio.getFrequency(), this.radio.getModulation(),
            this.radio.getVolume());
    }
}
